package ec.edu.udla.fichamedica.client;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HasText;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Widget;

import ec.edu.udla.fichamedica.client.ui.PersonList;

public class Principal extends Composite implements HasText {

	private static PrincipalUiBinder uiBinder = GWT
			.create(PrincipalUiBinder.class);
	@UiField Button button;

	interface PrincipalUiBinder extends UiBinder<Widget, Principal> {
	}

	public Principal() {
		initWidget(uiBinder.createAndBindUi(this));
	}

	public Principal(String firstName) {
		initWidget(uiBinder.createAndBindUi(this));
//		button.setText(firstName);
	}

	public void setText(String text) {
//		button.setText(text);
	}

	public String getText() {
		return "";
	}

	@UiHandler("button")
	void onButtonClick(ClickEvent event) {
		RootPanel.get().clear();
		PersonList personList = new PersonList();
		RootPanel.get().add(personList);
		
	}
}
